home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group00b.txt
/
000129_icon-group-sender_Mon Oct 30 16:26:53 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2001-01-03
|
3KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id e9UNQWH14118
for icon-group-addresses; Mon, 30 Oct 2000 16:26:32 -0700 (MST)
Message-Id: <200010302326.e9UNQWH14118@baskerville.CS.Arizona.EDU>
Date: Mon, 30 Oct 2000 20:49:57 +0000 (GMT)
From: Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk>
X-Sender: hgs@neelix
To: symbiot@my-deja.com
cc: Icon Group <icon-group@cs.arizona.edu>
Subject: Re: How would the experts handle this...??
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1989
You wanted replies to be public, so...
On Mon, 30 Oct 2000 symbiot@my-deja.com wrote:
> I wish to scan thru a file and determine how letters "connect" with one
> Exmaple:
[...]
> Here's how I have tackled the problem:
>
> while line := read(data) do
> {
> index := 0
> while index <= *line do
> {
Why are you doing all this work? There is every to do this for you.
>
> if not(line[index+1] == " ") then
> {
There is no else clause, so the test succeeds or fails. Look at &
to get the leverage off this feature
>
> centerchar := line[index+1]
>
> leftchar[centerchar] := leftchar[centerchar] || line[index]
> rightchar[centerchar] := rightchar[centerchar] || line[index +2]
>
> } #if not....
You won't need that
>
> index +:= 1
or this
> # do it again
> }# end (while index <= *line)
>
> }# end (while line := read(data))
or this.
>
the same applies to the output.
[output section trimmed]
>
> -----
> Thus far, I have been roundly criticized by icon afficiandos for my use
> of explicit indexing. It seems to me an intuitive way to handle the
Not so intuitive when you have to make sure you increment, etc. The
intuitive way is *not* to count the elements till you reach the end.
That is a roundabout way of saying process EVERY element in turn. Icon
already understands "every". It is not idiomatic Icon. It gets the job
done, but so does driving in first gear. :-)
> problems I've faced and makes the program "readable" to the layman.
Generally, the layman should not be reading your code. :-) You should
assume some fluency. If the point is subtle, write it clearly, but if
it is a language feature, then just use it. Yes, one can go overboard the
other way. One can do that in any language.
>
> But, be that as it may, I'm curious as to how those "in the know" would
> handle this problem in a more "icon-esque" fashion.
>
> Your suggestions are greatly appreciated.
>
> Thanx!!
>
HTH
Hugh
hgs@dmu.ac.uk